package com.yun.algorithmproblem.leetcode;

import com.yun.datastructure.tree.binarytree.domain.TreeNode;

public class Leetcode1038 {
    /**
     * 方法1：反序中序遍历
     */
    int sum=0;
    public TreeNode bstToGst(TreeNode root) {
        if(root!=null){
            bstToGst(root.right);
            sum+= root.val;
            root.val=sum;
            bstToGst(root.left);
        }
        return root;
    }

    /**
     * 方法2：Morris遍历
     */

}
